/*
 * sc_dbc.h
 *
 *  Created on: Jul 21, 2010
 *      Author: sdaniele
 */

#ifndef SC_DBC_H_
#define SC_DBC_H_

#include "sysc/kernel/sc_simcontext.h"
#include <assert.h>

namespace sc_core {


//#define NDEBUG

extern sc_simcontext* sc_curr_simcontext;


class sc_dbc {
private:
	sc_dbc();

private:
	static bool simc_init(){
		return sc_curr_simcontext!=0;
	}

public:

	static void unreachable(){
		assert(0);
	}

	static void running(){
		assert(
				simc_init() &&
				sc_is_running()
			);
	}

	static void not_running(){
		assert(
				!simc_init() ||
				sc_is_running()
			);
	}

	static void init_phase(){
		assert(
				simc_init() &&
				sc_is_running() &&
				sc_get_curr_simcontext()->init_phase()
			  );
	}

	static void eval_phase(){
		assert(
				simc_init() &&
				sc_is_running() &&
				sc_get_curr_simcontext()->eval_phase()
			  );
	}

	static void noti_phase(){
		assert(
				simc_init() &&
				sc_is_running() &&
				sc_get_curr_simcontext()->noti_phase()
			  );
	}
	static void update_phase(){
		assert(
				simc_init() &&
				sc_is_running() &&
				sc_get_curr_simcontext()->update_phase()
			  );
	}

	static void par(){
			assert(
					simc_init() &&
					sc_is_running() &&
					sc_get_curr_simcontext()->is_in_par()
				  );
		}

	static void nonpar(){
				assert(
						!simc_init() ||
						!sc_is_running() ||
						!sc_get_curr_simcontext()->is_in_par()
					  );
			}
};

}

#endif /* SC_DBC_H_ */
